﻿Public Partial Class NewTutorial
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub btn_Submit_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_Submit.Click

        Dim conn As OleDb.OleDbConnection = _
        New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("TutorialConnectionString").ToString())

        Dim sqlString As String = _
        "INSERT INTO Tutorial_List (Title, Link, Description) VALUES(@Title, @Link, @Description)"

        conn.Open()

        Dim dbCmd As OleDb.OleDbCommand = _
        New OleDb.OleDbCommand(sqlString, conn)

        dbCmd.Parameters.AddWithValue("@Title", tb_Title.Text)
        dbCmd.Parameters.AddWithValue("@Link", tb_Link.Text)
        dbCmd.Parameters.AddWithValue("@Description", tb_Description.Text)

        dbCmd.ExecuteNonQuery()

        dbCmd.Dispose()

        conn.Close()

        conn.Dispose()

        Response.Redirect("default.aspx")


        


    End Sub
End Class